package com.app.micaihu.view.army.adapter

import com.app.micaihu.view.army.adapter.messageprovider.*
import com.app.micaihu.view.bean.ArmyMessage
import com.chad.library.adapter.base.BaseProviderMultiAdapter
import com.chad.library.adapter.base.module.LoadMoreModule

/**
 * 军团消息
 */
class ArmyMessageListAdapter : BaseProviderMultiAdapter<ArmyMessage>(), LoadMoreModule {

    companion object {
        const val itemGone = 0// 默认
        const val itemManage = 1// 管理员消息
        const val itemUser = 2// 用户消息
        const val itemCenter = 3// 中间提示消息
        const val itemInvite = 4// 邀请
    }

    init {
        //列表 状态0等待通过，1已通过，2拒绝，3退出
        addItemProvider(MessageManageItemProvider())
        addItemProvider(MessageUserItemProvider())
        addItemProvider(MessageCenterItemProvider())
        addItemProvider(MessageInviteItemProvider())
    }

    override fun getItemType(data: List<ArmyMessage>, position: Int): Int {
        val item = data[position]
        return when (item.type) {
            itemManage -> itemManage
            itemUser -> itemUser
            itemCenter -> itemCenter
            itemInvite -> itemInvite
            else -> itemGone
        }
    }


}